package cn.lycode.system.domain.dto.syspost;

import cn.lycode.common.utils.SecurityUtils;
import cn.lycode.system.domain.entity.SysPost;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * SysPost修改DTO
 *
 * @since 2024-09-03
 * @author lyCode
 */
@Data
public class SysPostUpdateDTO {

    @NotNull(message = "id不能为空")
    private Long id; //岗位ID
    private String postCode; //岗位编码
    private String postName; //岗位名称
    private Long sort; //显示顺序
    private String remark; //备注

  public SysPost buildUpEntity() {
    SysPost sysPost = new SysPost();
    sysPost.setId(this.id);
    sysPost.setPostCode(this.postCode);
    sysPost.setPostName(this.postName);
    sysPost.setSort(this.sort);
    sysPost.setRemark(this.remark);
    sysPost.setUpdateTime(new Date());
    sysPost.setUpdateBy(SecurityUtils.getLoginUsername());
    return sysPost;
  }

}